

#include "NotificationsOverlay.h"
#include "OgrePanelOverlayElement.h"


#define TIME_TO_DISPLAY_NOTIFICATION   30.0   // seconds


NotificationsOverlay::NotificationsOverlay()
   {
 //  theOverlay = OverlayManager::getSingleton().getByName("NotificationsOverlay");
   activeNotificationsCount = 0;
  // Hide();
   }


NotificationsOverlay::~NotificationsOverlay()
   {
   }



void NotificationsOverlay::AddNotification(String theNotification, ColourValue &textColor)
   {
       /*
   int      notificationIndex;
   String   tempString;
   String   nextNotificationElementName;

   // Move all notifications up one in the list
   for (notificationIndex = min(activeNotificationsCount, NOTIFICATIONS_COUNT - 1); notificationIndex > 0; notificationIndex--)
      {
      notifications[notificationIndex].notificationString = notifications[notificationIndex - 1].notificationString;
      notifications[notificationIndex].timeLeftToDisplay  = notifications[notificationIndex - 1].timeLeftToDisplay;
      notifications[notificationIndex].textColor          = notifications[notificationIndex - 1].textColor;

      nextNotificationElementName = "Notifications/Text" + StringConverter::toString(notificationIndex);
      OverlayManager::getSingleton().getOverlayElement(nextNotificationElementName)->setCaption(notifications[notificationIndex - 1].notificationString);
      OverlayManager::getSingleton().getOverlayElement(nextNotificationElementName)->setColour(notifications[notificationIndex - 1].textColor);
      }

   notifications[0].notificationString = theNotification;
   notifications[0].timeLeftToDisplay  = TIME_TO_DISPLAY_NOTIFICATION;
   notifications[0].textColor          = textColor;

   OverlayManager::getSingleton().getOverlayElement("Notifications/Text0")->setCaption(theNotification);
   OverlayManager::getSingleton().getOverlayElement("Notifications/Text0")->setColour(textColor);

   if (activeNotificationsCount < NOTIFICATIONS_COUNT)
      activeNotificationsCount++;*/
   }



void NotificationsOverlay::FrameStarted(Real timeElapsed)
   {
       /*
   if (activeNotificationsCount == 0)
      return;

   for (int notificationIndex = 0; notificationIndex < activeNotificationsCount; notificationIndex++)
      notifications[notificationIndex].timeLeftToDisplay -= timeElapsed;

   while ((activeNotificationsCount > 0) && (notifications[activeNotificationsCount - 1].timeLeftToDisplay <= 0))
      {
      String nextNotificationElementName;

      // Clear the oldest notification
      activeNotificationsCount--;
      nextNotificationElementName = "Notifications/Text" + StringConverter::toString(activeNotificationsCount);
      OverlayManager::getSingleton().getOverlayElement(nextNotificationElementName)->setCaption("");
      }
      */
   }
